1. Field of the Invention
This invention relates to a code reader for reading a code, such as a bar code or the like displayed on a medium by scanning it by a photoelectric converter to decode information indicated by the code and to output it and, more particularly, to a code reader in which the reading rate of a multilevel bar code is improved.
2. Description of the Prior Art
There are as a bar code a binary level code in which "0" is indicated by a thin bar (narrow bar: Nb) or space (narrow space: Ns) and "1" is indicated by a thick bar (wide bar: Wb) or space (wide space: Ws), and a multilevel bar code in which "1" is indicated by a bar (B), "0" is indicated by a space (S), and and the same logic value is indicated by a bar or space having different width.
A bar code system is disclosed in "Method of forming bar code system" on pages 179-199 of Sensor Interfacing No. 4 of separate volume of Transistor Technology issued by CQ Publishing Co., Ltd. on July 1, 1984.
FIG. 6 is a pattern view showing an example of "JAN code" as a multilevel bar code. In FIG. 6, guard bars G1, G2 and G3 are disposed at both ends and the center of the code, and a plurality of bars or spaces, here a
code of 6 characters (C1-C6, C7-C12) are displayed as a code composed of two pairs of bars or spaces between the guard bars of the ends and the central guard bar.
As described above, the multilevel bar code shown in FIG. 6 displays one code unit (one character) by two pairs of bars/spaces, and the amplitude (width) of each bar or space has an integer number times (n) as large as a basic unit (hereinafter referred to as "a basic module"). The width of the basic module (unit module) m is defined as the width of a guard bar G. In shown quaternary level code, information of a code is displayed by bars or spaces having widths of m, 2m, 3m and 4 m, and one character is composed of the width (7 m) of 7 basic modules (the module number n becomes n=7 when one character is composed of two pairs of bars or spaces).
FIG. 7 is an explanatory view of a calculation of decoding a multilevel bar code in FIG. 6. The magnitude of the basic module (m) is obtained by attaining the width of a guard bar G1 read at the initial of scanning by a photoelectric converter (hereinafter referred to as "a scanner") as the counted value of clocks, and dividing the width of the subsequent bar or space by this value to obtain the magnification of m for each. A character C in the example in FIG. 7 is displayed by "1110010" of 7 bits (n=7), since B1 is 3 m, S1 is 2 n, B2 is m, and S2 is m in width.
In the prior art described above, the level of the bar or space for composing a character is determined by dividing with integer number the number of counting clocks of the bar or space subsequently loaded as a dividend by the number of counting clocks of the basic module m initially loaded as a divisor.
Since the bar code of this type is displayed by using a printer on a medium, it might be oozed at the time of printing it. In case of reading it by a scanner, a gradation might occur in a scanner optical system or a scanning speed might not be constant. Thus, the number of counting the bar or space loaded is displaced from the value of the magnification of an integer number of basic module m with respect to the number of counting the m. Then, the number of the bar code divided by the basic module, for example, among two pairs of bars or spaces for composing a character becomes more or less than the specified number n, thereby causing an error in reading. In fact, in most cases, the dividing result becomes less rather than more than the specified number n, and it frequently becomes (n-1) 1 less than the specified number.
This means that, in the reading by the scanner, it is ordinarily impossible that the value of counting clocks of each bar or space exceeds one basic module, and if it might occur, its printer or scanner should have a problem.
The number of the basic modules for composing each bar or space is determined by the division of integer number, and the remainder generated in the calculation is discarded in each division. Accordingly, if (n-2) frequently occurs, its printer or scanner should have a trouble similarly to the above case, and it is rare that the module number becomes (n-2) or less. Such being the case, if a remedy for the case of (n-1) is provided, most errors can be obviated.